home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / DShowIDL / axcore.idl < prev    next >
Text File  |  2001-10-08  |  51KB  |  1,285 lines

  1. //------------------------------------------------------------------------------
  2. // File: AXCore.idl
  3. //
  4. // Desc: Core streaming interfaces.  Other ActiveMovie-only interfaces
  5. //       are in AXExtend.idl.
  6. //
  7. // Copyright (c) 1992-2001, Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10.  
  11. // include unknwn.idl and objidl.idl first
  12.  
  13. #define CHARS_IN_GUID 39  // 128 bits, plus { - } punctuation and terminal null
  14.                           // chars NOT BYTES in the standard representation
  15.                           // e.g. {D3588AB0-0781-11ce-B03A-0020AF0BA770} + null
  16.  
  17. cpp_quote("#define CHARS_IN_GUID     39")
  18.  
  19.  
  20. //=====================================================================
  21. //=====================================================================
  22. // media types & formats
  23. //=====================================================================
  24. //=====================================================================
  25.  
  26. // There is a high-level media type (audio, compressed video,
  27. // mpeg video, midi). Within each type, there is a subtype (cinepak, pcm)
  28. // and a length+untyped data block defining the format in a
  29. // type-specific manner. EG for video/cinepak, the data block would be
  30. // a bitmapinfo.
  31. // The contents of the format block are defined by the formattype GUID.
  32. // For example, FORMAT_VideoInfo, FORMAT_WaveFormatEx. In the future, this
  33. // may be a pointer to an object supporting property style interfaces
  34. // in which case the GUID may be something like FORMAT_IUnknown. When
  35. // you are passed a media type you should check the format type, if
  36. // it isn't a type you recognize, then don't touch the format block
  37.  
  38. typedef struct _AMMediaType {
  39.     GUID     majortype;
  40.     GUID     subtype;
  41.     BOOL     bFixedSizeSamples;
  42.     BOOL     bTemporalCompression;
  43.     ULONG    lSampleSize;
  44.     GUID     formattype;
  45.     IUnknown *pUnk;
  46.     ULONG    cbFormat;
  47.     [size_is(cbFormat)] BYTE * pbFormat;
  48. } AM_MEDIA_TYPE;
  49.  
  50. //=====================================================================
  51. //=====================================================================
  52. // pin information
  53. //=====================================================================
  54. //=====================================================================
  55.  
  56. // is this an input or output pin
  57. typedef enum _PinDirection {
  58.     PINDIR_INPUT,
  59.     PINDIR_OUTPUT
  60. } PIN_DIRECTION;
  61.  
  62. // other types that need defining
  63. #define MAX_PIN_NAME     128
  64. cpp_quote("#define MAX_PIN_NAME     128")
  65. cpp_quote("#define MAX_FILTER_NAME  128")
  66. #define MAX_FILTER_NAME  128
  67.  
  68.  
  69. //=====================================================================
  70. //=====================================================================
  71. // time information
  72. //
  73. // This represents a time (either reference or stream) in 100ns units.
  74. // The class library contains a CRefTime helper class
  75. // that supports simple comparison and arithmetic operations
  76. //=====================================================================
  77. //=====================================================================
  78.  
  79. typedef LONGLONG REFERENCE_TIME;
  80. typedef double REFTIME;
  81.  
  82. // Win32 HANDLEs have to be cast to these as the MIDL compiler doesn't
  83. // like the HANDLE type or in fact anything remotely associated with
  84. // them. If this ever gets ported to a MAC environment then these will
  85. // have to become an alertable synchronisation object that it supports
  86.  
  87. typedef DWORD_PTR HSEMAPHORE;
  88. typedef DWORD_PTR HEVENT;
  89.  
  90. //=====================================================================
  91. //=====================================================================
  92. // Allocator properties
  93. //
  94. // Used to describe the actual properties of an allocator,
  95. // and used to request properties from an allocator or from an upstream
  96. // filter that could create an allocator. See IMemAllocator and
  97. // IMemInputPin.
  98. //=====================================================================
  99. //=====================================================================
  100. typedef struct _AllocatorProperties {
  101.         long cBuffers;  // count of buffers at this allocator
  102.         long cbBuffer;  // size of each buffer, excluding any prefix
  103.  
  104.         // alignment of the buffer - buffer start will be aligned on a multiple of
  105.         // this amount
  106.         long cbAlign;
  107.  
  108.         // prefix amount. Each buffer is immediately preceeded by cbPrefix bytes.
  109.         // note that GetPointer points to the beginning of the buffer proper.
  110.         // the prefix is aligned, i.e. (GetPointer() - cbPrefix) is aligned on cbAlign.
  111.         long cbPrefix;
  112. } ALLOCATOR_PROPERTIES;
  113.  
  114.  
  115.  
  116.  
  117.  
  118. // forward declarations (in alphabetical order - we were getting duplicates)
  119. interface IAMovieSetup;
  120. interface IEnumFilters;
  121. interface IEnumMediaTypes;
  122. interface IEnumPins;
  123. interface IBaseFilter;
  124. interface IFilterGraph;
  125. interface IMediaFilter;
  126. interface IMediaSample;
  127. interface IMemAllocator;
  128. interface IMemAllocatorCallbackTemp;
  129. interface IMemAllocatorNotifyCallbackTemp;
  130. interface IMemInputPin;
  131. interface IPin;
  132. interface IReferenceClock;
  133.  
  134.  
  135.  
  136. //=====================================================================
  137. //=====================================================================
  138. // Defines IPin interface
  139. //
  140. // interface representing a single, unidirection connection point on a
  141. // filter. A Pin will connect to exactly one other pin on another filter.
  142. // This interface represents the interface other objects can call on
  143. // this pin. The interface between the filter and the pin is private to
  144. // the implementation of a specific filter.
  145. //
  146. // During the connection process, one pin will be instructed to take
  147. // the lead: the connect interface on this pin will be calling, passing
  148. // the IPin* for the other pin. This connecting pin will call the
  149. // ReceiveConnection member function on the other pin, as well as presumably
  150. // other format-enumeration and queryinterface calls to establish whether
  151. // the connection is possible.
  152. //=====================================================================
  153. //=====================================================================
  154.  
  155. [
  156. object,
  157. uuid(56a86891-0ad4-11ce-b03a-0020af0ba770),
  158. pointer_default(unique)
  159. ]
  160. interface IPin : IUnknown {
  161.  
  162.     // initiate a connection to another pin. calls ReceiveConnection on the
  163.     // other pin. Verifies that the connection is possible and may reject
  164.     // it.
  165.     // The mediatype parameter is optional. If it is not null, the pin must
  166.     // connect using that media type if possible. The subtype and/or format
  167.     // type can be GUID_NULL, meaning that the pin can fill them in as desired.
  168.     // This allows an application to partially specify the media type to be
  169.     // used for the connection, insisting on eg YUV 422 but leaving details
  170.     // (such as the image size) to be negotiated between the pins.
  171.     HRESULT Connect(
  172.         [in] IPin * pReceivePin,        // connect yourself to this pin
  173.         [in] const AM_MEDIA_TYPE * pmt  // (optional) connect using this type
  174.     );
  175.  
  176.     // called by a connecting pin to make a connection
  177.     HRESULT ReceiveConnection(
  178.         [in] IPin * pConnector,
  179.         [in] const AM_MEDIA_TYPE *pmt   // this is the media type we will exchange
  180.     );
  181.  
  182.     // break a connection - no params since there is only one connection
  183.     // possible on this pin
  184.     HRESULT Disconnect(void);
  185.  
  186.     // Find the pin this pin is connected to (if any)
  187.     // The pointer returned is AddRef()d
  188.     // Fails if the pin is not connected
  189.     HRESULT ConnectedTo(
  190.         [out] IPin **pPin
  191.     );
  192.  
  193.     // Return the media type of a connection if the pin is connected
  194.     HRESULT ConnectionMediaType(
  195.         [out] AM_MEDIA_TYPE *pmt
  196.     );
  197.  
  198.     // get information about the pin itself
  199.     typedef struct _PinInfo {
  200.     IBaseFilter *pFilter;   // the filter this pin is on
  201.     PIN_DIRECTION dir;  // am I an input or output pin?
  202.     WCHAR achName[MAX_PIN_NAME];    // the name of this pin within this filter
  203.     } PIN_INFO;
  204.  
  205.     HRESULT QueryPinInfo(
  206.         [out] PIN_INFO * pInfo
  207.     );
  208.  
  209.     // We often want to know the direction.  Rather than use the
  210.     // relatively expensive QueryPinInfo, use this
  211.     HRESULT QueryDirection(
  212.         [out] PIN_DIRECTION *pPinDir
  213.     );
  214.  
  215.     // Get an identifier for the pin (allows connections to be saved).
  216.     // The storage will be allocated by the filter using CoTaskMemAlloc
  217.     // The caller should free it using CoTaskMemFree
  218.     HRESULT QueryId(
  219.         [out] LPWSTR * Id
  220.     );
  221.  
  222.     // will the pin accept the format type, S_OK yes, S_FALSE no
  223.     HRESULT QueryAccept(
  224.         [in] const AM_MEDIA_TYPE *pmt
  225.     );
  226.  
  227.     // return an enumerator for this pin's preferred media types
  228.     HRESULT EnumMediaTypes(
  229.         [out] IEnumMediaTypes **ppEnum
  230.     );
  231.  
  232.     // return an array of IPin* - the pins that this pin internally connects to
  233.     // All pins put in the array must be AddReffed (but no others)
  234.     // Errors: "Can't say" - FAIL; not enough slots - return S_FALSE
  235.     // Default: return E_NOTIMPL
  236.     // The filter graph will interpret E_NOTIMPL as any input pin connects to
  237.     // all visible output pins and vise versa.
  238.     // apPin can be NULL if nPin==0 (not otherwise).
  239.     HRESULT QueryInternalConnections(
  240.         [out] IPin* *apPin,     // array of IPin*
  241.         [in, out] ULONG *nPin   // on input, the number of slots
  242.                                 // on output  the number of pins
  243.     );
  244.  
  245.     // notify the pin that no more data is expected until a new run
  246.     // command is issued. End of stream should be queued and delivered after
  247.     // all queued data is delivered. Pass through if there is no queued data.
  248.     // Flush should flush any queued EOS.
  249.     // returns S_OK unless there is some error.
  250.     // input pins only: output pins will normally return E_UNEXPECTED.
  251.     HRESULT EndOfStream(void);
  252.  
  253.     // Flush
  254.  
  255.     // Enter flush state: do the following steps (in order)
  256.     // -- prevent any more Receives succeeding (set a flushing flag)
  257.     // -- discard any queued data
  258.     // -- free anyone blocked on Receive in your filter
  259.     // -- pass BeginFlush to any downstream pins
  260.     HRESULT BeginFlush(void);
  261.  
  262.     // End flush state: do the following steps in order
  263.     // -- ensure no more data will be pushed by your filter
  264.     //    (sync with thread if you have one, stop it pushing and
  265.     //     discard any queued data)
  266.     // -- re-enable Receive (clear internal flushing flag)
  267.     // -- pass EndFlush to any downstream pins
  268.     HRESULT EndFlush(void);
  269.  
  270.     // informational: all data arriving after this call is part of a segment
  271.     // from StartTime to StopTime, played at rate. This allows filters that
  272.     // process buffers containing more than one sample to clip the rendering
  273.     // to within the start and stop times.
  274.     //
  275.     // A source pin will call a destination pin on this method after completing
  276.     // delivery of any previous data, and before any Receive calls for the
  277.     // new data
  278.     HRESULT NewSegment(
  279.                 [in] REFERENCE_TIME tStart,
  280.                 [in] REFERENCE_TIME tStop,
  281.                 [in] double dRate);
  282. }
  283.  
  284. typedef IPin *PPIN;
  285.  
  286.  
  287. //=====================================================================
  288. //=====================================================================
  289. // Defines IEnumPins interface
  290. //
  291. // interface returned from IBaseFilter::EnumPins(). based on IEnumXXXX
  292. //=====================================================================
  293. //=====================================================================
  294.  
  295. [
  296. object,
  297. uuid(56a86892-0ad4-11ce-b03a-0020af0ba770),
  298. pointer_default(unique)
  299. ]
  300. interface IEnumPins : IUnknown {
  301.  
  302.     HRESULT Next(
  303.         [in] ULONG cPins,                       // place this many pins...
  304.         [out, size_is(cPins)] IPin ** ppPins,   // ...in this array
  305.         [out] ULONG * pcFetched                 // actual count passed
  306.     );
  307.  
  308.     HRESULT Skip(
  309.         [in] ULONG cPins);
  310.  
  311.     HRESULT Reset(void);
  312.  
  313.     HRESULT Clone(
  314.         [out] IEnumPins **ppEnum
  315.     );
  316. }
  317.  
  318. typedef IEnumPins *PENUMPINS;
  319.  
  320.  
  321. //=====================================================================
  322. //=====================================================================
  323. // Defines IEnumMediaTypes interface
  324. //
  325. // Enumerates the preferred formats for a pin
  326. //=====================================================================
  327. //=====================================================================
  328.  
  329. [
  330. object,
  331. uuid(89c31040-846b-11ce-97d3-00aa0055595a),
  332. pointer_default(unique)
  333. ]
  334. interface IEnumMediaTypes : IUnknown {
  335.  
  336.     // to call this member function pass in the address of a pointer to a
  337.     // media type. The interface will allocate the necessary AM_MEDIA_TYPE
  338.     // structures and initialise them with the variable format block
  339.  
  340.     HRESULT Next(
  341.         [in] ULONG cMediaTypes,             // place this many types...
  342.         [out, size_is(cMediaTypes)]
  343.              AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array
  344.         [out] ULONG * pcFetched             // actual count passed
  345.     );
  346.  
  347.     HRESULT Skip(
  348.         [in] ULONG cMediaTypes);
  349.  
  350.     HRESULT Reset(void);
  351.  
  352.     HRESULT Clone(
  353.         [out] IEnumMediaTypes **ppEnum
  354.     );
  355. }
  356.  
  357. typedef IEnumMediaTypes *PENUMMEDIATYPES;
  358.  
  359.  
  360.  
  361. //========================================================================
  362. //========================================================================
  363. // Defines IFilterGraph interface
  364. //
  365. // abstraction representing a graph of filters
  366. // This allows filters to be joined into a graph and operated as a unit.
  367. //========================================================================
  368. //========================================================================
  369.  
  370. [
  371. object,
  372. uuid(56a8689f-0ad4-11ce-b03a-0020af0ba770),
  373. pointer_default(unique)
  374. ]
  375. interface IFilterGraph : IUnknown {
  376.  
  377.     //==========================================================================
  378.     // Low level filter functions
  379.     //==========================================================================
  380.  
  381.         // Add a filter to the graph and name it with *pName.
  382.         // If the name is not unique, The request will fail.
  383.         // The Filter graph will call the JoinFilterGraph
  384.         // member function of the filter to inform it.
  385.         // This must be called before attempting Connect, ConnectDirect or Render
  386.         // for pins of the filter.
  387.  
  388.         HRESULT AddFilter
  389.             ( [in] IBaseFilter * pFilter,
  390.               [in, string] LPCWSTR pName
  391.             );
  392.  
  393.  
  394.         // Remove a filter from the graph. The filter graph implementation
  395.         // will inform the filter that it is being removed.
  396.  
  397.         HRESULT RemoveFilter
  398.             ( [in] IBaseFilter * pFilter
  399.             );
  400.  
  401.  
  402.         // Set *ppEnum to be an enumerator for all filters in the graph.
  403.  
  404.         HRESULT EnumFilters
  405.             ( [out] IEnumFilters **ppEnum
  406.             );
  407.  
  408.  
  409.         // Set *ppFilter to be the filter which was added with the name *pName
  410.         // Will fail and set *ppFilter to NULL if the name is not in this graph.
  411.  
  412.         HRESULT FindFilterByName
  413.             ( [in, string] LPCWSTR pName,
  414.               [out] IBaseFilter ** ppFilter
  415.             );
  416.  
  417.     //==========================================================================
  418.     // Low level connection functions
  419.     //==========================================================================
  420.  
  421.         // Connect these two pins directly (i.e. without intervening filters)
  422.         // the media type is optional, and may be partially specified (that is
  423.         // the subtype and/or format type may be GUID_NULL). See IPin::Connect
  424.         // for details of the media type parameter.
  425.         HRESULT ConnectDirect
  426.             ( [in] IPin * ppinOut,              // the output pin
  427.               [in] IPin * ppinIn,               // the input pin
  428.               [in, unique] const AM_MEDIA_TYPE* pmt     // optional mediatype
  429.             );
  430.  
  431.         // Break the connection that this pin has and reconnect it to the
  432.         // same other pin.
  433.  
  434.         HRESULT Reconnect
  435.             ( [in] IPin * ppin        // the pin to disconnect and reconnect
  436.             );
  437.  
  438.  
  439.  
  440.         // Disconnect this pin, if connected.  Successful no-op if not connected.
  441.  
  442.         HRESULT Disconnect
  443.             ( [in] IPin * ppin
  444.             );
  445.  
  446.     //==========================================================================
  447.     // intelligent connectivity - now in IGraphBuilder, axextend.idl
  448.     //==========================================================================
  449.  
  450.     //==========================================================================
  451.     // Whole graph functions
  452.     //==========================================================================
  453.  
  454.     // Once a graph is built, it can behave as a (composite) filter.
  455.     // To control this filter, QueryInterface for IMediaFilter.
  456.  
  457.     // The filtergraph will by default ensure that the graph has a sync source
  458.     // when it is made to Run.  SetSyncSource(NULL) will prevent that and allow
  459.     // all the filters to run unsynchronised until further notice.
  460.     // SetDefaultSyncSource will set the default sync source (the same as would
  461.     // have been set by default on the first call to Run).
  462.     HRESULT SetDefaultSyncSource(void);
  463.  
  464. }
  465.  
  466. typedef IFilterGraph *PFILTERGRAPH;
  467.  
  468.  
  469.  
  470. //==========================================================================
  471. //==========================================================================
  472. // Defines IEnumFilters interface
  473. //
  474. // enumerator interface returned from IFilterGraph::EnumFilters().
  475. // based on IEnum pseudo-template
  476. //==========================================================================
  477. //==========================================================================
  478.  
  479. [
  480. object,
  481. uuid(56a86893-0ad4-11ce-b03a-0020af0ba770),
  482. pointer_default(unique)
  483. ]
  484. interface IEnumFilters : IUnknown {
  485.  
  486.     HRESULT Next
  487.         ( [in]  ULONG cFilters,           // place this many filters...
  488.           [out] IBaseFilter ** ppFilter,  // ...in this array of IBaseFilter*
  489.           [out] ULONG * pcFetched         // actual count passed returned here
  490.         );
  491.  
  492.  
  493.     HRESULT Skip
  494.         ( [in] ULONG cFilters
  495.         );
  496.  
  497.  
  498.     HRESULT Reset(void);
  499.  
  500.  
  501.     HRESULT Clone
  502.         ( [out] IEnumFilters **ppEnum
  503.         );
  504. }
  505.  
  506. typedef IEnumFilters *PENUMFILTERS;
  507.  
  508.  
  509. //=====================================================================
  510. //=====================================================================
  511. // Defines IMediaFilter interface
  512. //
  513. // multimedia components that provide time-based data will expose this.
  514. // this interface abstracts an object that processes time-based data streams
  515. // and represents a multimedia device (possibly implemented in software).
  516. // it controls the active/running state of the object and its synchronization
  517. // to other objects in the system.
  518. //
  519. // derived from IPersist so that all filter-type objects in a graph
  520. // can have their class id serialised.
  521. //=====================================================================
  522. //=====================================================================
  523.  
  524. [
  525. object,
  526. uuid(56a86899-0ad4-11ce-b03a-0020af0ba770),
  527. pointer_default(unique)
  528. ]
  529. interface IMediaFilter : IPersist {
  530.  
  531.     // tell the filter to transition to the new state. The state transition
  532.     // may not be instantaneous (external mechanical activity may be involved,
  533.     // for example). The state functions may return before the state
  534.     // transition has completed
  535.  
  536.     // these functions will return S_OK if the transition is complete, S_FALSE if
  537.     // the transition is not complete but no error has occurred, or some error value
  538.     // if the transition failed.
  539.     HRESULT Stop(void);
  540.     HRESULT Pause(void);
  541.  
  542.     // in order to synchronise independent streams, you must pass a time
  543.     // value with the Run command. This is the difference between stream
  544.     // time and reference time. That is, it is the amount to be added to
  545.     // the IMediaSample timestamp to get the time at which that sample
  546.     // should be rendered according to the reference clock.
  547.     // If we are starting at the beginning of the stream, it will thus be
  548.     // simply the time at which the first sample should appear. If we are
  549.     // restarting from Paused mode in midstream, then it will be the total
  550.     // time we have been paused added to the initial start time.
  551.  
  552.     // the filtergraph will provide this information to its filters. If you
  553.     // are an app calling the filtergraph, it's ok to pass a start time of
  554.     // 0, in which case the filter graph will calculate a soon-as-possible
  555.     // time. FilterGraphs will accept 0 meaning ASAP; most filters will not.
  556.  
  557.     HRESULT Run(REFERENCE_TIME tStart);
  558.  
  559.  
  560.     // possible states that the filter could be in
  561.     typedef enum _FilterState {
  562.         State_Stopped,            // not in use
  563.         State_Paused,             // holding resources, ready to go
  564.         State_Running             // actively processing media stream
  565.     } FILTER_STATE;
  566.  
  567.     // find out what state the filter is in.
  568.     // If timeout is 0, will return immediately - if a state transition is
  569.     // not complete, it will return the state being transitioned into, and
  570.     // the return code will be VFW_S_STATE_INTERMEDIATE.  if no state
  571.     // transition is in progress the state will be returned and the return
  572.     // code will be S_OK.
  573.     //
  574.     // If timeout is non-zero, GetState will not return until the state
  575.     // transition is complete, or the timeout expires.
  576.     // The timeout is in milliseconds.
  577.     // You can also pass in INFINITE as a special value for the timeout, in
  578.     // which case it will block indefinitely waiting for the state transition
  579.     // to complete. If the timeout expires, the state returned is the
  580.     // state we are trying to reach, and the return code will be
  581.     // VFW_S_STATE_INTERMEDIATE. If no state transition is in progress
  582.     // the routine returns immediately with return code S_OK.
  583.  
  584.     //
  585.     // return State is State_Running, State_Paused or State_Stopped.
  586.     // return code is S_OK, or VFW_S_STATE_INTERMEDIATE if state
  587.     // transition is not complete or an error value if the method failed.
  588.     HRESULT GetState(
  589.                 [in] DWORD dwMilliSecsTimeout,
  590.                 [out] FILTER_STATE *State);
  591.  
  592.  
  593.     // tell the filter the reference clock to which it should synchronize
  594.     // activity. This is most important to rendering filters and may not
  595.     // be of any interest to other filters.
  596.     HRESULT SetSyncSource(
  597.         [in] IReferenceClock * pClock);
  598.  
  599.     // get the reference clock currently in use (it may be NULL)
  600.     HRESULT GetSyncSource(
  601.         [out] IReferenceClock ** pClock);
  602. }
  603.  
  604. typedef IMediaFilter *PMEDIAFILTER;
  605.  
  606.  
  607. //=====================================================================
  608. //=====================================================================
  609. // Defines IBaseFilter interface
  610. //
  611. // all multimedia components will expose this interface
  612. // this interface abstracts an object that has typed input and output
  613. // connections and can be dynamically aggregated.
  614. //
  615. // IMediaFilter supports synchronisation and activity state: IBaseFilter
  616. // is derived from that since all filters need to support IMediaFilter,
  617. // whereas a few objects (plug-in control distributors for example) will
  618. // support IMediaFilter but not IBaseFilter.
  619. //
  620. // IMediaFilter is itself derived from IPersist so that every filter
  621. //supports GetClassID()
  622. //=====================================================================
  623. //=====================================================================
  624.  
  625. [
  626. object,
  627. uuid(56a86895-0ad4-11ce-b03a-0020af0ba770),
  628. pointer_default(unique)
  629. ]
  630. interface IBaseFilter : IMediaFilter {
  631.  
  632.     // enumerate all the pins available on this filter
  633.     // allows enumeration of all pins only.
  634.     //
  635.     HRESULT EnumPins(
  636.         [out] IEnumPins ** ppEnum     // enum interface returned here
  637.     );
  638.  
  639.     // Convert the external identifier of a pin to an IPin *
  640.     // This pin id is quite different from the pin Name in CreatePin.
  641.     // In CreatePin the Name is invented by the caller.  In FindPin the Id
  642.     // must have come from a previous call to IPin::QueryId.  Whether or not
  643.     // this operation would cause a pin to be created depends on the filter
  644.     // design, but if called twice with the same id it should certainly
  645.     // return the same pin both times.
  646.     HRESULT FindPin(
  647.         [in, string] LPCWSTR Id,
  648.         [out] IPin ** ppPin
  649.     );
  650.  
  651.     // find out information about this filter
  652.     typedef struct _FilterInfo {
  653.     WCHAR achName[MAX_FILTER_NAME]; // maybe null if not part of graph
  654.         IFilterGraph * pGraph;                   // null if not part of graph
  655.     } FILTER_INFO;
  656.  
  657.     HRESULT QueryFilterInfo(
  658.         [out] FILTER_INFO * pInfo
  659.     );
  660.  
  661.     // notify a filter that it has joined a filter graph. It is permitted to
  662.     // refuse. The filter should addref and store this interface for later use
  663.     // since it may need to notify events to this interface. A null pointer indicates
  664.     // that the filter is no longer part of a graph.
  665.     HRESULT JoinFilterGraph(
  666.         [in] IFilterGraph * pGraph,
  667.         [in, string] LPCWSTR pName
  668.     );
  669.  
  670.     // return a Vendor information string. Optional - may return E_NOTIMPL.
  671.     // memory returned should be freed using CoTaskMemFree
  672.     HRESULT QueryVendorInfo(
  673.         [out, string] LPWSTR* pVendorInfo
  674.     );
  675. }
  676.  
  677. typedef IBaseFilter *PFILTER;
  678.  
  679.  
  680. //=====================================================================
  681. //=====================================================================
  682. // sync and state management
  683. //=====================================================================
  684. //=====================================================================
  685.  
  686.  
  687. //=====================================================================
  688. //=====================================================================
  689. // Defines IReferenceClock interface
  690. //=====================================================================
  691. //=====================================================================
  692.  
  693. [
  694.         object,
  695.         uuid(56a86897-0ad4-11ce-b03a-0020af0ba770),
  696.         pointer_default(unique)
  697. ]
  698. interface IReferenceClock : IUnknown {
  699.  
  700.     // get the time now
  701.     HRESULT GetTime(
  702.         [out] REFERENCE_TIME *pTime
  703.     );
  704.  
  705.     // ask for an async notification that a time has elapsed
  706.     HRESULT AdviseTime(
  707.         [in] REFERENCE_TIME baseTime,       // base reference time
  708.         [in] REFERENCE_TIME streamTime,     // stream offset time
  709.     [in] HEVENT hEvent,                     // advise via this event
  710.         [out] DWORD_PTR * pdwAdviseCookie   // where your cookie goes
  711.     );
  712.  
  713.     // ask for an async periodic notification that a time has elapsed
  714.     HRESULT AdvisePeriodic(
  715.         [in] REFERENCE_TIME startTime,      // starting at this time
  716.         [in] REFERENCE_TIME periodTime,     // time between notifications
  717.         [in] HSEMAPHORE hSemaphore,         // advise via a semaphore
  718.     [out] DWORD_PTR * pdwAdviseCookie       // where your cookie goes
  719.     );
  720.  
  721.     // cancel a request for notification
  722.     HRESULT Unadvise(
  723.         [in] DWORD_PTR dwAdviseCookie);
  724. }
  725.  
  726. typedef IReferenceClock *PREFERENCECLOCK;
  727.  
  728. //=====================================================================
  729. //=====================================================================
  730. // Defines IReferenceClock2 interface
  731. //=====================================================================
  732. //=====================================================================
  733.  
  734. [
  735.         object,
  736.         uuid(36b73885-c2c8-11cf-8b46-00805f6cef60),
  737.         pointer_default(unique)
  738. ]
  739. interface IReferenceClock2 : IReferenceClock {
  740. }
  741.  
  742. typedef IReferenceClock2 *PREFERENCECLOCK2;
  743.  
  744.  
  745. //=====================================================================
  746. //=====================================================================
  747. // Data transport interfaces
  748. //=====================================================================
  749. //=====================================================================
  750.  
  751.  
  752. //=====================================================================
  753. //=====================================================================
  754. // Defines IMediaSample interface
  755. //=====================================================================
  756. //=====================================================================
  757.  
  758. [
  759.         local,
  760.         object,
  761.         uuid(56a8689a-0ad4-11ce-b03a-0020af0ba770),
  762.         pointer_default(unique)
  763. ]
  764. interface IMediaSample : IUnknown {
  765.  
  766.     // get me a read/write pointer to this buffer's memory. I will actually
  767.     // want to use sizeUsed bytes.
  768.     HRESULT GetPointer([out] BYTE ** ppBuffer);
  769.  
  770.     // return the size in bytes of the buffer data area
  771.     long GetSize(void);
  772.  
  773.     // get the stream time at which this sample should start and finish.
  774.     HRESULT GetTime(
  775.         [out] REFERENCE_TIME * pTimeStart,  // put time here
  776.         [out] REFERENCE_TIME * pTimeEnd
  777.     );
  778.  
  779.     // Set the stream time at which this sample should start and finish.
  780.     // pTimeStart==pTimeEnd==NULL will invalidate the time stamps in
  781.     // this sample
  782.     HRESULT SetTime(
  783.         [in] REFERENCE_TIME * pTimeStart,   // put time here
  784.         [in] REFERENCE_TIME * pTimeEnd
  785.     );
  786.  
  787.     // sync-point property. If true, then the beginning of this
  788.     // sample is a sync-point. (note that if AM_MEDIA_TYPE.bTemporalCompression
  789.     // is false then all samples are sync points). A filter can start
  790.     // a stream at any sync point.  S_FALSE if not sync-point, S_OK if true.
  791.  
  792.     HRESULT IsSyncPoint(void);
  793.     HRESULT SetSyncPoint(BOOL bIsSyncPoint);
  794.  
  795.     // preroll property.  If true, this sample is for preroll only and
  796.     // shouldn't be displayed.
  797.     HRESULT IsPreroll(void);
  798.     HRESULT SetPreroll(BOOL bIsPreroll);
  799.  
  800.     long GetActualDataLength(void);
  801.     HRESULT SetActualDataLength(long);
  802.  
  803.     // these allow for limited format changes in band - if no format change
  804.     // has been made when you receive a sample GetMediaType will return S_FALSE
  805.  
  806.     HRESULT GetMediaType(AM_MEDIA_TYPE **ppMediaType);
  807.     HRESULT SetMediaType(AM_MEDIA_TYPE *pMediaType);
  808.  
  809.     // returns S_OK if there is a discontinuity in the data (this frame is
  810.     // not a continuation of the previous stream of data
  811.     // - there has been a seek or some dropped samples).
  812.     HRESULT IsDiscontinuity(void);
  813.     // set the discontinuity property - TRUE if this sample is not a
  814.     // continuation, but a new sample after a seek or a dropped sample.
  815.     HRESULT SetDiscontinuity(BOOL bDiscontinuity);
  816.  
  817.     // get the media times for this sample
  818.     HRESULT GetMediaTime(
  819.         [out] LONGLONG * pTimeStart,
  820.         [out] LONGLONG * pTimeEnd
  821.     );
  822.  
  823.     // Set the media times for this sample
  824.     // pTimeStart==pTimeEnd==NULL will invalidate the media time stamps in
  825.     // this sample
  826.     HRESULT SetMediaTime(
  827.         [in] LONGLONG * pTimeStart,
  828.         [in] LONGLONG * pTimeEnd
  829.     );
  830. }
  831.  
  832. typedef IMediaSample *PMEDIASAMPLE;
  833.  
  834. //  Values for dwFlags for AM_SAMPLE_PROPERTIES
  835. enum tagAM_SAMPLE_PROPERTY_FLAGS
  836.      { AM_SAMPLE_SPLICEPOINT        = 0x01,   /* Is this a splice point
  837.                                                  IE can it be decoded
  838.                                                  without reference to
  839.                                                  previous data */
  840.        AM_SAMPLE_PREROLL            = 0x02,   /* Is this a preroll sample */
  841.        AM_SAMPLE_DATADISCONTINUITY  = 0x04,   /* Set if start of new segment */
  842.        AM_SAMPLE_TYPECHANGED        = 0x08,   /* Has the type changed */
  843.        AM_SAMPLE_TIMEVALID          = 0x10,   /* Set if time is valid */
  844.        AM_SAMPLE_TIMEDISCONTINUITY  = 0x40,   /* time gap in data starts after
  845.                                                  this sample - pbBuffer can
  846.                                                  be NULL
  847.                                               */
  848.        AM_SAMPLE_FLUSH_ON_PAUSE     = 0x80,   /*  For live data - discard
  849.                                                   in paused state
  850.                                               */
  851.        AM_SAMPLE_STOPVALID          = 0x100,  /*  Stop time is valid */
  852.        AM_SAMPLE_ENDOFSTREAM        = 0x200,  /*  End of stream after
  853.                                                   this data
  854.                                                   This is reserved for
  855.                                                   kernel streaming and is
  856.                                                   not currently used by
  857.                                                   ActiveMovie
  858.                                               */
  859.        AM_STREAM_MEDIA              = 0,      /*  Normal data stream id */
  860.        AM_STREAM_CONTROL            = 1       /*  Control stream id */
  861.                                               /*  > 7FFFFFFF is application
  862.                                                   defined stream
  863.                                               */
  864.      };
  865.  
  866. //  Media sample generic properties structure
  867. typedef struct tagAM_SAMPLE2_PROPERTIES {
  868.     DWORD    cbData;         //  Length of generic data for extensiblity
  869.                              //  Number of bytes INCLUDING this field
  870.     DWORD    dwTypeSpecificFlags; // Type specific flag data
  871.     DWORD    dwSampleFlags;  //  Flags bits defined by  AM_SAMPLE_xxx flags
  872.                              //  All undefined bits RESERVED (set to 0,
  873.                              //  leave on copy)
  874.     LONG     lActual;        //  Length of data in buffer
  875.     REFERENCE_TIME tStart;   //  Start time if valid
  876.     REFERENCE_TIME tStop;    //  Stop time if valid
  877.     DWORD    dwStreamId;     //  Stream 0 is normal media transport
  878.                              //  Stream 1 is control
  879.     AM_MEDIA_TYPE *pMediaType; // Copy of media type - INVALID after Release()
  880.     BYTE    *pbBuffer;       //  Pointer to buffer - INVALID after Release()
  881.     LONG     cbBuffer;       //  Length of buffer
  882. } AM_SAMPLE2_PROPERTIES;
  883.  
  884. //=====================================================================
  885. //=====================================================================
  886. // Defines IMediaSample2 interface
  887. //=====================================================================
  888. //=====================================================================
  889.  
  890. [
  891.         local,
  892.         object,
  893.         uuid(36b73884-c2c8-11cf-8b46-00805f6cef60),
  894.         pointer_default(unique)
  895. ]
  896. interface IMediaSample2 : IMediaSample {
  897.  
  898.     //  Get sample properties
  899.     //
  900.     //      cbProperties - length of generic data to retrieve
  901.     //      pbProperties - pointer to generic data buffer - can
  902.     //                     be NULL if cbProperties is NULL
  903.     //                     data conforms to AM_SAMPLE_PROPERTIES
  904.     //
  905.     HRESULT GetProperties(
  906.         [in] DWORD cbProperties,
  907.         [out, size_is(cbProperties)] BYTE * pbProperties
  908.     );
  909.     //  Set sample properties
  910.     //
  911.     //      cbProperties - length of generic data to set
  912.     //      pbProperties - pointer to generic data buffer - can
  913.     //                      be NULL if cbProperties is NULL
  914.     //                      data conforms to AM_SAMPLE_PROPERTIES
  915.     //
  916.     //
  917.     HRESULT SetProperties(
  918.         [in] DWORD cbProperties,
  919.         [in, size_is(cbProperties)] const BYTE * pbProperties
  920.     );
  921.  
  922.  
  923.     // //  Get the clock associated with the sample
  924.     // HRESULT GetClock(
  925.     //     [out] IReferenceClock2 **ppClock
  926.     // );
  927.  
  928.     // //  Get a pointer to the object containing the data
  929.     // //
  930.     // //  riid      - IID of interface required on object
  931.     // //  ppvobject - Pointer to object containing the data
  932.     // //
  933.     // //  Returns
  934.     // //      S_OK - Got the object
  935.     // //      E_NOINTERFACE - object does not support this interface
  936.     // //                      if IUnknown is not supported
  937.     // //                      there is no backing object
  938.     // //      E_NOTIMPL     - samples don't have backing objects
  939.     // //
  940.     // //
  941.     // HRESULT GetBackingObject(
  942.     //     [in]  REFIID riid,
  943.     //     [out] void **ppvObject
  944.     // );
  945. }
  946.  
  947. typedef IMediaSample2 *PMEDIASAMPLE2;
  948.  
  949.  
  950. // flags for dwFlags in IMemAllocator::GetBuffer
  951. // AM_GBF_PREVFRAMESKIPPED is only significant when asking for a buffer from the
  952. // video renderer.  It should be TRUE if and only if the previous frame
  953. // was skipped.  It affects quality management.
  954. // AM_GBF_NOTASYNCPOINT indicates to the downstream filter (most likely the
  955. // video renderer) that you are not going to fill this buffer with a sync point
  956. // (keyframe) so now would be a bad time to return a buffer with a dynamic
  957. // format change, because you will be unable to switch to the new format without
  958. // waiting for the next sync point, causing some frames to be dropped.
  959. #define AM_GBF_PREVFRAMESKIPPED 1
  960. #define AM_GBF_NOTASYNCPOINT    2
  961. cpp_quote("#define AM_GBF_PREVFRAMESKIPPED 1")
  962. cpp_quote("#define AM_GBF_NOTASYNCPOINT 2")
  963.  
  964. // This may not be supported by allocators
  965. cpp_quote("#define AM_GBF_NOWAIT 4")
  966.  
  967. // This flag is supported by the VMR's surface allocator
  968. // When set the DDraw surface used for the media sample
  969. // is returned is an un-locked state.  Calls the GetPointer on
  970. // the returned media sample will fail and return a NULL pointer
  971. //
  972. cpp_quote("#define AM_GBF_NODDSURFACELOCK 8")
  973.  
  974. //=====================================================================
  975. //=====================================================================
  976. // Defines IMemAllocator interface
  977. //
  978. // an allocator of IMediaSample blocks to be used for data transfer between
  979. // pins. Can be provided by input, output or a third party. Release
  980. // the IMediaSample object obtained back to the pool by calling
  981. // IMediaSample::Release.
  982. //=====================================================================
  983. //=====================================================================
  984.  
  985. [
  986.         object,
  987.         uuid(56a8689c-0ad4-11ce-b03a-0020af0ba770),
  988.         pointer_default(unique)
  989. ]
  990. interface IMemAllocator : IUnknown {
  991.  
  992.     // negotiate buffer sizes, buffer count and alignment. pRequest is filled
  993.     // in by the caller with the requested values. pActual will be returned
  994.     // by the allocator with the closest that the allocator can come to this.
  995.     // Cannot be called unless the allocator is decommitted.
  996.     // Calls to GetBuffer need not succeed until Commit is called.
  997.     HRESULT SetProperties(
  998.         [in] ALLOCATOR_PROPERTIES* pRequest,
  999.         [out] ALLOCATOR_PROPERTIES* pActual);
  1000.  
  1001.     // return the properties actually being used on this allocator
  1002.     HRESULT GetProperties(
  1003.         [out] ALLOCATOR_PROPERTIES* pProps);
  1004.  
  1005.  
  1006.     // commit the memory for the agreed buffers
  1007.     HRESULT Commit(void);
  1008.  
  1009.     // release the memory for the agreed buffers. Any threads waiting in
  1010.     // GetBuffer will return with an error. GetBuffer calls will always fail
  1011.     // if called before Commit or after Decommit.
  1012.     HRESULT Decommit(void);
  1013.  
  1014.     // get container for a sample. Blocking, synchronous call to get the
  1015.     // next free buffer (as represented by an IMediaSample interface).
  1016.     // on return, the time etc properties will be invalid, but the buffer
  1017.     // pointer and size will be correct.
  1018.     // Will only succeed if memory is committed. If GetBuffer is blocked
  1019.     // waiting for a buffer and Decommit is called on another thread,
  1020.     // GetBuffer will return with an error.
  1021.     HRESULT GetBuffer(
  1022.         [out] IMediaSample **ppBuffer,
  1023.         [in] REFERENCE_TIME * pStartTime,
  1024.         [in] REFERENCE_TIME * pEndTime,
  1025.         [in] DWORD dwFlags
  1026.     );
  1027.  
  1028.     // put a buffer back on the allocators free list.
  1029.     // this is typically called by the Release() method of the media
  1030.     // sample when the reference count goes to 0
  1031.     //
  1032.     HRESULT ReleaseBuffer(
  1033.         [in] IMediaSample *pBuffer
  1034.     );
  1035. }
  1036.  
  1037. typedef IMemAllocator *PMEMALLOCATOR;
  1038.  
  1039. //=====================================================================
  1040. //=====================================================================
  1041. // Defines IMemAllocatorCallbackTemp interface
  1042. //
  1043. // If the allocator supports IMemAllocator2 then callbacks are
  1044. // available
  1045. //
  1046. //=====================================================================
  1047. //=====================================================================
  1048. [
  1049.         object,
  1050.         uuid(379a0cf0-c1de-11d2-abf5-00a0c905f375),
  1051.         pointer_default(unique)
  1052. ]
  1053. interface IMemAllocatorCallbackTemp : IMemAllocator {
  1054.  
  1055.     //  Set notification interface.  pNotify can be NULL
  1056.     HRESULT SetNotify(
  1057.         [in] IMemAllocatorNotifyCallbackTemp *pNotify);
  1058.  
  1059.     //  Get current stats
  1060.     HRESULT GetFreeCount(
  1061.         [out] LONG *plBuffersFree);
  1062. }
  1063.  
  1064. //=====================================================================
  1065. //=====================================================================
  1066. // Defines IMemAllocatorNotify interface
  1067. //
  1068. //=====================================================================
  1069. //=====================================================================
  1070. [
  1071.         object,
  1072.         uuid(92980b30-c1de-11d2-abf5-00a0c905f375),
  1073.         pointer_default(unique)
  1074. ]
  1075. interface IMemAllocatorNotifyCallbackTemp : IUnknown {
  1076.  
  1077.     //  Called whenever ReleaseBuffer is called in the allocator
  1078.     //  Note the caller may have acquired locks and this call may
  1079.     //  occur in any context so generally the implementor of this
  1080.     //  call will just set an event or post a message for another
  1081.     //  thread to take action.
  1082.     HRESULT NotifyRelease();
  1083. }
  1084.  
  1085. //=====================================================================
  1086. //=====================================================================
  1087. // Defines IMemInputPin interface
  1088. //
  1089. // basic shared memory transport interface.
  1090. //=====================================================================
  1091. //=====================================================================
  1092.  
  1093. [
  1094.         object,
  1095.         uuid(56a8689d-0ad4-11ce-b03a-0020af0ba770),
  1096.         pointer_default(unique)
  1097. ]
  1098. interface IMemInputPin : IUnknown {
  1099.  
  1100.     // return the allocator interface that this input pin
  1101.     // would like the output pin to use
  1102.     HRESULT GetAllocator(
  1103.                 [out] IMemAllocator ** ppAllocator);
  1104.  
  1105.     // tell the input pin which allocator the output pin is actually
  1106.     // going to use.
  1107.     // If the readonly flag is set, then all samples from this allocator are
  1108.     // to be treated as read-only, and should be copied before being modified.
  1109.     HRESULT NotifyAllocator(
  1110.                 [in] IMemAllocator * pAllocator,
  1111.                 [in] BOOL bReadOnly
  1112.                 );
  1113.  
  1114.     // this method is optional (can return E_NOTIMPL). Output pins are not obliged to call
  1115.     // this method, nor are they obliged to fulfil the request. Input pins making such a
  1116.     // request should check the allocator in NotifyAllocator to see if it meets their needs. If
  1117.     // not, the input pin is responsible for any necessary data copy.
  1118.     // Zero values will be treated as don't care: so a pin can return an alignment value
  1119.     // and leave the other values 0.
  1120.     HRESULT GetAllocatorRequirements( [out] ALLOCATOR_PROPERTIES*pProps);
  1121.  
  1122.     // here's the next block of data from the stream. AddRef it if
  1123.     // you need to hold it beyond the end of the Receive call.
  1124.     // call pSample->Release when done with it.
  1125.     //
  1126.     // This is a blocking synchronous call.  Usually no blocking
  1127.     // will occur but if a filter cannot process the sample immediately
  1128.     // it may use the caller's thread to wait until it can.
  1129.     HRESULT Receive(
  1130.                 [in] IMediaSample * pSample);
  1131.  
  1132.     // Same as Receive but with multiple samples.  Useful for
  1133.     // fragmented streams
  1134.     HRESULT ReceiveMultiple(
  1135.                 [in, size_is(nSamples)] IMediaSample **pSamples,
  1136.                 [in] long nSamples,
  1137.                 [out] long *nSamplesProcessed);
  1138.  
  1139.     // See if Receive might block
  1140.     // Returns S_OK if it can block, S_FALSE if it can't or some
  1141.     // failure code (assume it can in this case)
  1142.     HRESULT ReceiveCanBlock();
  1143. }
  1144.  
  1145. typedef IMemInputPin *PMEMINPUTPIN;
  1146.  
  1147.  
  1148. //=====================================================================
  1149. //=====================================================================
  1150. // Defines IAMovieSetup interface
  1151. //
  1152. // exported by filter to allow it to be self-registering
  1153. //=====================================================================
  1154. //=====================================================================
  1155.  
  1156. [
  1157. object,
  1158. uuid(a3d8cec0-7e5a-11cf-bbc5-00805f6cef20),
  1159. pointer_default(unique)
  1160. ]
  1161. interface IAMovieSetup : IUnknown {
  1162.  
  1163.     // methods to register and unregister filter, etc.
  1164.  
  1165.     HRESULT Register( );
  1166.     HRESULT Unregister( );
  1167. }
  1168.  
  1169. typedef IAMovieSetup *PAMOVIESETUP;
  1170.  
  1171.  
  1172. //=====================================================================
  1173. //=====================================================================
  1174. // Defines IMediaSeeking interface
  1175. //
  1176. // Controls seeking (time, bytes, frames, fields and samples)
  1177. //=====================================================================
  1178. //=====================================================================
  1179.  
  1180. typedef enum AM_SEEKING_SeekingFlags
  1181. {
  1182.     AM_SEEKING_NoPositioning        = 0x00,     // No change
  1183.     AM_SEEKING_AbsolutePositioning  = 0x01,     // Position is supplied and is absolute
  1184.     AM_SEEKING_RelativePositioning  = 0x02,     // Position is supplied and is relative
  1185.     AM_SEEKING_IncrementalPositioning   = 0x03, // (Stop) position relative to current
  1186.                                                 // Useful for seeking when paused (use +1)
  1187.     AM_SEEKING_PositioningBitsMask  = 0x03,     // Useful mask
  1188.     AM_SEEKING_SeekToKeyFrame       = 0x04,     // Just seek to key frame (performance gain)
  1189.     AM_SEEKING_ReturnTime           = 0x08,     // Plug the media time equivalents back into the supplied LONGLONGs
  1190.  
  1191.     AM_SEEKING_Segment              = 0x10,     // At end just do EC_ENDOFSEGMENT,
  1192.                                                 // don't do EndOfStream
  1193.     AM_SEEKING_NoFlush              = 0x20      // Don't flush
  1194. } AM_SEEKING_SEEKING_FLAGS;
  1195.  
  1196. typedef enum AM_SEEKING_SeekingCapabilities
  1197. {
  1198.     AM_SEEKING_CanSeekAbsolute     = 0x001,
  1199.     AM_SEEKING_CanSeekForwards     = 0x002,
  1200.     AM_SEEKING_CanSeekBackwards    = 0x004,
  1201.     AM_SEEKING_CanGetCurrentPos    = 0x008,
  1202.     AM_SEEKING_CanGetStopPos       = 0x010,
  1203.     AM_SEEKING_CanGetDuration      = 0x020,
  1204.     AM_SEEKING_CanPlayBackwards    = 0x040,
  1205.     AM_SEEKING_CanDoSegments       = 0x080,
  1206.     AM_SEEKING_Source              = 0x100  // Doesn't pass thru used to
  1207.                                             // count segment ends
  1208. } AM_SEEKING_SEEKING_CAPABILITIES;
  1209.  
  1210. [
  1211.         object,
  1212.         uuid(36b73880-c2c8-11cf-8b46-00805f6cef60),
  1213.         pointer_default(unique)
  1214. ]
  1215. interface IMediaSeeking : IUnknown {
  1216.  
  1217.     // Returns the capability flags
  1218.     HRESULT GetCapabilities( [out] DWORD * pCapabilities );
  1219.  
  1220.     // And's the capabilities flag with the capabilities requested.
  1221.     // Returns S_OK if all are present, S_FALSE if some are present, E_FAIL if none.
  1222.     // *pCababilities is always updated with the result of the 'and'ing and can be
  1223.     // checked in the case of an S_FALSE return code.
  1224.     HRESULT CheckCapabilities( [in,out] DWORD * pCapabilities );
  1225.  
  1226.     // returns S_OK if mode is supported, S_FALSE otherwise
  1227.     HRESULT IsFormatSupported([in] const GUID * pFormat);
  1228.     HRESULT QueryPreferredFormat([out] GUID * pFormat);
  1229.  
  1230.     HRESULT GetTimeFormat([out] GUID *pFormat);
  1231.     // Returns S_OK if *pFormat is the current time format, otherwise S_FALSE
  1232.     // This may be used instead of the above and will save the copying of the GUID
  1233.     HRESULT IsUsingTimeFormat([in] const GUID * pFormat);
  1234.  
  1235.     // (may return VFE_E_WRONG_STATE if graph is stopped)
  1236.     HRESULT SetTimeFormat([in] const GUID * pFormat);
  1237.  
  1238.     // return current properties
  1239.     HRESULT GetDuration([out] LONGLONG *pDuration);
  1240.     HRESULT GetStopPosition([out] LONGLONG *pStop);
  1241.     HRESULT GetCurrentPosition([out] LONGLONG *pCurrent);
  1242.  
  1243.     // Convert time from one format to another.
  1244.     // We must be able to convert between all of the formats that we say we support.
  1245.     // (However, we can use intermediate formats (e.g. MEDIA_TIME).)
  1246.     // If a pointer to a format is null, it implies the currently selected format.
  1247.     HRESULT ConvertTimeFormat([out] LONGLONG * pTarget, [in] const GUID * pTargetFormat,
  1248.                               [in]  LONGLONG    Source, [in] const GUID * pSourceFormat );
  1249.  
  1250.  
  1251.     // Set current and end positions in one operation
  1252.     // Either pointer may be null, implying no change
  1253.     HRESULT SetPositions( [in,out] LONGLONG * pCurrent, [in] DWORD dwCurrentFlags
  1254.             , [in,out] LONGLONG * pStop, [in] DWORD dwStopFlags );
  1255.  
  1256.     // Get CurrentPosition & StopTime
  1257.     // Either pointer may be null, implying not interested
  1258.     HRESULT GetPositions( [out] LONGLONG * pCurrent,
  1259.                           [out] LONGLONG * pStop );
  1260.  
  1261.     // Get earliest / latest times to which we can currently seek "efficiently".
  1262.     // This method is intended to help with graphs where the source filter has
  1263.     // a very high latency.  Seeking within the returned limits should just
  1264.     // result in a re-pushing of already cached data.  Seeking beyond these
  1265.     // limits may result in extended delays while the data is fetched (e.g.
  1266.     // across a slow network).
  1267.     // (NULL pointer is OK, means caller isn't interested.)
  1268.     HRESULT GetAvailable( [out] LONGLONG * pEarliest, [out] LONGLONG * pLatest );
  1269.  
  1270.     // Rate stuff
  1271.     HRESULT SetRate([in]  double dRate);
  1272.     HRESULT GetRate([out] double * pdRate);
  1273.  
  1274.     // Preroll
  1275.     HRESULT GetPreroll([out] LONGLONG * pllPreroll);
  1276. }
  1277.  
  1278. typedef IMediaSeeking *PMEDIASEEKING;
  1279.  
  1280. //  Flags for IMediaEventEx
  1281. cpp_quote("enum tagAM_MEDIAEVENT_FLAGS")
  1282. cpp_quote("{")
  1283. cpp_quote("    AM_MEDIAEVENT_NONOTIFY = 0x01")
  1284. cpp_quote("};")
  1285.